package com.example.rabbitmqdemo.springbootRabbitmq;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class HelloCustomer {

    /*@RabbitListener(queuesToDeclare = @Queue(value = "hello", durable = "false"))
    @RabbitHandler
    public void receive1(String message) {
        System.out.println("message: " + message);
    }*/


    @RabbitListener(bindings = {
            @QueueBinding(
                    value = @Queue(value = "hello2"),
                    exchange = @Exchange(name = "directs"),
                    key = {"info", "error", "warn"}
            )}
    )
    public void receive2(String message) {
        System.out.println("message: " + message);
    }
}
